<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="en" name="language">
	<title>compare</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link media="screen" href="../docutils-api.css" type="text/css" rel="stylesheet">

</head>

<body>

<div class="banner">
<img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
<span class="title">GraphicsMagick</span>
<form action="http://www.google.com/search">
  <input type="hidden" name="domains" value="www.graphicsmagick.org" />
  <input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
<span class="nowrap"><input type="text" name="q" size="25" maxlength="255" />&nbsp;<input type="submit" name="sa" value="Search" /></span>
</form>
</div>


<div class="navmenu">
<ul>
  <li><a href="../index.html">Home</a></li>
  <li><a href="../project.html">Project</a></li>
  <li><a href="../download.html">Download</a></li>
  <li><a href="../README.html">Install</a></li>
  <li><a href="../Hg.html">Source</a></li>
  <li><a href="../NEWS.html">News</a> </li>
  <li><a href="../utilities.html">Utilities</a></li>
  <li><a href="../programming.html">Programming</a></li>
  <li><a href="../reference.html">Reference</a></li>
</ul>
</div>

<main id="compare">
<h1 class="title">compare</h1>
<p class="subtitle" id="compare-images">Compare images</p>
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#differenceimage" id="id13">DifferenceImage</a></p></li>
<li><p><a class="reference internal" href="#getimagechanneldifference" id="id14">GetImageChannelDifference</a></p></li>
<li><p><a class="reference internal" href="#getimagechanneldistortion" id="id15">GetImageChannelDistortion</a></p></li>
<li><p><a class="reference internal" href="#getimagedistortion" id="id16">GetImageDistortion</a></p></li>
<li><p><a class="reference internal" href="#isimagesequal" id="id17">IsImagesEqual</a></p></li>
<li><p><a class="reference internal" href="#initializedifferenceimageoptions" id="id18">InitializeDifferenceImageOptions</a></p></li>
<li><p><a class="reference internal" href="#initializedifferencestatistics" id="id19">InitializeDifferenceStatistics</a></p></li>
</ul>
</div>
<section id="differenceimage">
<h1><a class="toc-backref" href="#id13">DifferenceImage</a></h1>
<section id="synopsis">
<h2>Synopsis</h2>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *DifferenceImage( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image, const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image,
                        const DifferenceImageOptions *difference_options,
                        <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="description">
<h2>Description</h2>
<p>DifferenceImage() returns an annotated difference image based on the
the difference between a reference image and a compare image.</p>
<p>The format of the DifferenceImage method is:</p>
<pre class="literal-block"><a class="reference external" href="../api/types.html#image">Image</a> *DifferenceImage( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image, const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image,
                        const DifferenceImageOptions *difference_options,
                        <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>reference_image:</dt>
<dd><p>the reference image.</p>
</dd>
<dt>compare_image:</dt>
<dd><p>the comparison image.</p>
</dd>
<dt>difference_options:</dt>
<dd><p>options to use when differencing.</p>
</dd>
<dt>channel:</dt>
<dd><p>the channel(s) to compare.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="getimagechanneldifference">
<h1><a class="toc-backref" href="#id14">GetImageChannelDifference</a></h1>
<section id="id1">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail GetImageChannelDifference( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image,
                                          const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image,
                                          const MetricType metric,
                                          DifferenceStatistics *statistics,
                                          <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id2">
<h2>Description</h2>
<p>GetImageChannelDifference() updates a user provided statistics structure
with per-channel, and totalized, difference statistics corresponding
to a specified comparison metric.</p>
<p>The format of the GetImageChannelDifference method is:</p>
<pre class="literal-block">MagickPassFail GetImageChannelDifference( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image,
                                          const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image,
                                          const MetricType metric,
                                          DifferenceStatistics *statistics,
                                          <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>reference_image:</dt>
<dd><p>the reference image.</p>
</dd>
<dt>compare_image:</dt>
<dd><p>the comparison image.</p>
</dd>
<dt>metric:</dt>
<dd><p>metric to use when differencing.</p>
</dd>
<dt>statistics:</dt>
<dd><p>the statistics structure to populate.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="getimagechanneldistortion">
<h1><a class="toc-backref" href="#id15">GetImageChannelDistortion</a></h1>
<section id="id3">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail GetImageChannelDistortion( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image,
                                          const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image,
                                          const <a class="reference external" href="../api/types.html#channeltype">ChannelType</a> channel,
                                          const MetricType metric, double *distortion,
                                          <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id4">
<h2>Description</h2>
<p>GetImageChannelDistortion() updates a distortion parameter with the
distortion (error) computed according to the specified comparison metric.
The value returned is only for the channel specified.</p>
<p>The format of the GetImageChannelDistortion method is:</p>
<pre class="literal-block">MagickPassFail GetImageChannelDistortion( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image,
                                          const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image,
                                          const <a class="reference external" href="../api/types.html#channeltype">ChannelType</a> channel,
                                          const MetricType metric, double *distortion,
                                          <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>reference_image:</dt>
<dd><p>the reference image.</p>
</dd>
<dt>compare_image:</dt>
<dd><p>the comparison image.</p>
</dd>
<dt>channel:</dt>
<dd><p>the channel to obtain error data for.</p>
</dd>
<dt>metric:</dt>
<dd><p>metric to use when differencing.</p>
</dd>
<dt>distortion:</dt>
<dd><p>updated with the computed distortion.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="getimagedistortion">
<h1><a class="toc-backref" href="#id16">GetImageDistortion</a></h1>
<section id="id5">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail GetImageDistortion( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image,
                                   const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image, const MetricType metric,
                                   double *distortion, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id6">
<h2>Description</h2>
<p>GetImageDistortion() updates a distortion parameter with the distortion
(error) computed according to the specified comparison metric.  The value
returned reflects all enabled channels.</p>
<p>The format of the GetImageDistortion method is:</p>
<pre class="literal-block">MagickPassFail GetImageDistortion( const <a class="reference external" href="../api/types.html#image">Image</a> *reference_image,
                                   const <a class="reference external" href="../api/types.html#image">Image</a> *compare_image, const MetricType metric,
                                   double *distortion, <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>reference_image:</dt>
<dd><p>the reference image.</p>
</dd>
<dt>compare_image:</dt>
<dd><p>the comparison image.</p>
</dd>
<dt>channel:</dt>
<dd><p>the channel to obtain error data for.</p>
</dd>
<dt>metric:</dt>
<dd><p>metric to use when differencing.</p>
</dd>
<dt>distortion:</dt>
<dd><p>updated with the computed distortion.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="isimagesequal">
<h1><a class="toc-backref" href="#id17">IsImagesEqual</a></h1>
<section id="id7">
<h2>Synopsis</h2>
<pre class="literal-block">MagickBool IsImagesEqual( <a class="reference external" href="../api/types.html#image">Image</a> *image, const <a class="reference external" href="../api/types.html#image">Image</a> *reference );</pre>
</section>
<section id="id8">
<h2>Description</h2>
<p>IsImagesEqual() measures the difference between colors at each pixel
location of two images.  A value other than 0 means the colors match
exactly.  Otherwise an error measure is computed by summing over all
pixels in an image the distance squared in RGB space between each image
pixel and its corresponding pixel in the reference image.  The error
measure is assigned to these image members:</p>
<p>o mean_error_per_pixel:  The mean error for any single pixel in
the image.</p>
<p>o normalized_mean_error:  The normalized mean quantization error for
any single pixel in the image.  This distance measure is normalized to
a range between 0 and 1.  It is independent of the range of red, green,
and blue values in the image.</p>
<p>o normalized_maximum_error:  The normalized maximum quantization
error for any single pixel in the image.  This distance measure is
normalized to a range between 0 and 1.  It is independent of the range
of red, green, and blue values in your image.</p>
<p>A small normalized mean square error, accessed as
image-&gt;normalized_mean_error, suggests the images are very similar in
spatial layout and color.</p>
<p>The format of the IsImagesEqual method is:</p>
<pre class="literal-block">MagickBool IsImagesEqual( <a class="reference external" href="../api/types.html#image">Image</a> *image, const <a class="reference external" href="../api/types.html#image">Image</a> *reference );</pre>
<p>A description of each parameter follows.</p>
<dl class="simple">
<dt>image:</dt>
<dd><p>The image.</p>
</dd>
<dt>reference:</dt>
<dd><p>The reference image.</p>
</dd>
</dl>
</section>
</section>
<section id="initializedifferenceimageoptions">
<h1><a class="toc-backref" href="#id18">InitializeDifferenceImageOptions</a></h1>
<section id="id9">
<h2>Synopsis</h2>
<pre class="literal-block">void InitializeDifferenceImageOptions( DifferenceImageOptions *options,
                                       <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id10">
<h2>Description</h2>
<p>InitializeDifferenceImageOptions() assigns default options to a user-provided
DifferenceImageOptions structure.  This function should always be used
to initialize the DifferenceImageOptions structure prior to making any
changes to it.</p>
<p>The format of the InitializeDifferenceImageOptions method is:</p>
<pre class="literal-block">void InitializeDifferenceImageOptions( DifferenceImageOptions *options,
                                       <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>options:</dt>
<dd><p>pointer to DifferenceImageOptions structure to initialize.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
<section id="initializedifferencestatistics">
<h1><a class="toc-backref" href="#id19">InitializeDifferenceStatistics</a></h1>
<section id="id11">
<h2>Synopsis</h2>
<pre class="literal-block">void InitializeDifferenceStatistics( DifferenceStatistics *options,
                                     <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
</section>
<section id="id12">
<h2>Description</h2>
<p>InitializeDifferenceStatistics() assigns default options to a user-provided
DifferenceStatistics structure.</p>
<p>The format of the InitializeDifferenceStatistics method is:</p>
<pre class="literal-block">void InitializeDifferenceStatistics( DifferenceStatistics *options,
                                     <a class="reference external" href="../api/types.html#exceptioninfo">ExceptionInfo</a> *exception );</pre>
<dl class="simple">
<dt>options:</dt>
<dd><p>pointer to DifferenceStatistics structure to initialize.</p>
</dd>
<dt>exception:</dt>
<dd><p>Return any errors or warnings in this structure.</p>
</dd>
</dl>
</section>
</section>
</main>


<hr class="docutils">
<div class="document">
    <p><a href="../Copyright.html">Copyright</a> © GraphicsMagick Group 2002-2025<!--SPONSOR_LOGO--></p>
</div>

</main>
</body>
</html>
